import Vue from 'vue'
import VueRouter from 'vue-router'
import LoginView from '../components/LoginView.vue'
import RegisterView from '../components/RegisterView.vue'
import ProductView from '../views/ProductView.vue'
import PostDetails from '../components/post/PostDetails.vue'


Vue.use(VueRouter)

const routes = [
  {  
    path: '/',  
    redirect: '/product' // 设置重定向  
  },  
  {
    path: '/login',
    name: 'login',
    component: LoginView
  },
  {
    path: '/product',
    name: 'product',
    component: ProductView
  },
  {
    path: '/register',
    name: 'register',
    component: RegisterView
  },
  {
    path: '/details',
    name: 'details',
    component: PostDetails
  },
]

const router = new VueRouter({
  mode: 'history', // 使用 HTML5 History 模式 
  routes
})

export default router
